import {setMessage, getMessage} from "../../utils/localStorageData";

const state = {
  message: getMessage(),//系统
  isNewOutpatien: false,//挂号
  isNewPay: false,//收费（药房）
  isNewDrug:false,//发药
  isCharge:false,//收取服务费

}

const mutations = {
  SET_MESSAGE: (state, message) => {
    state.message = message
  },
  SET_NEW_OUTPATIEN: (state, value) => {
    state.isNewOutpatien = value
  },
  SET_NEW_PAY: (state, value) => {
    state.isNewPay = value
  },
  SET_NEW_DRUG:(state, value)=>{
    state.isNewDrug = value
  },
  SET_NEW_CHANGE:(state, value)=>{
    state.isCharge = value
  }
}

const actions = {
  setMessageSetting({commit}, message) {
    commit('SET_MESSAGE', message)
    setMessage(message)
  },
  setIsNewOutpatienting({commit}, value) {
    commit('SET_NEW_OUTPATIEN', value)
  },
  setIsNewPayting({commit}, value) {
    commit('SET_NEW_PAY', value)
  },
  setIsNewDrugting({commit}, value) {
    commit('SET_NEW_DRUG', value)
  },
  setIsChargeting({commit}, value) {
    commit('SET_NEW_CHANGE', value)
  },

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
